<?php
function save_intervals($start_time, $end_time, $interval) {

echo "Start Time : ".$start_time;
echo "&nbsp;&nbsp;";
echo "End Time : ".$end_time;
echo "<br/>";
echo "<br/>";
//Find number of intervals.
$num_intervals = floor(($end_time - $start_time) / $interval);

//Build a list of times.
$buffer_time = $start_time;
$times[$i]['end'] = $start_time;
//echo "&nbsp;&nbsp;";
$iso_starttime = date('h:i:s a', $start_time);
//echo "<br/>";
for($i = 0; $i < $num_intervals; $i++) 
{
        if(($i+1)!=$num_intervals)
		{
				$times[$i]['end'] = $buffer_time += $interval;
				//echo "&nbsp;&nbsp;";
				$iso_timeto[$i]['end'] = date('h:i:s a', $times[$i]['end']);
				//echo "<br/>";
	    }
}
return($iso_timeto[$i]['end']);
/*for($i = 0; $i < $num_intervals; $i++) 
{
  print_r($iso_timeto[$i]['end']);
  echo "<br/>";
}*/
//Do whatever with the "times" array...
}

?>